import ListBaseStore from './ListBaseStore';
import Apis from '../apis/car';
import { message } from 'antd';
import { WeaLocaleProvider } from 'ecCom';

const getLabel = WeaLocaleProvider.getLabel;
export default class CarApplySettingStore extends ListBaseStore {
  constructor() {
    super();
  }


  initCarApplySettingForm(callbackfun) {
    Apis.getCarApplySetting({}).then((result) => {
      if (result && result.isRight == 1) {
        this.conditioninfo = result.conditioninfo;
        this.initFormFields(this.conditioninfo);
        this.form.updateFields({
          isremind: {
            value: result.isremind,
          },
          remindtype: {
            value: `${result.remindtype}`,
          },
          isshare: {
            value: `${result.isshare}`,
          },

        });
      }
      if (callbackfun) {
        callbackfun(result.isRight);
      }
    });
  }

  saveCarApplySetting(params = {}) {
    Apis.saveCarApplySetting(params).then((result) => {
      if (result.status == '1') {
        message.success(getLabel(18758, '保存成功'));
      } else {
        message.error(getLabel(22620, '保存失败'));
      }
    });
  }
}
